package com.midian.action.mc.activity;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.midian.action.mc.common.AjaxAction;
import com.midian.common.annotation.FileModelDetails;
import com.midian.common.annotation.FunctionAnnotationOverride;
import com.midian.common.exception.BizException;
import com.midian.common.system.SysStatic;
import com.midian.model.activity.Activity;
import com.midian.model.activity.ActivityPic;
import com.midian.model.common.FileModel;
import com.midian.model.user.User;
import com.midian.service.activity.IActivityPicService;
import com.midian.service.activity.IActivityService;

/**
 * 活动图片Action
 * @author Mengfh
 *
 */
@Scope("prototype")
@Controller("activityPicAction")
@FunctionAnnotationOverride(isAction = true, auth = "活动图集管理")
public class ActivityPicAction extends AjaxAction<ActivityPic> {
	/**活动图片实体*/
	private ActivityPic entity;
	/**活动图片实体列表*/
	private List<ActivityPic> rows;
	/**活动图片业务*/
	private IActivityPicService activityPicService;
	/**活动图集*/
	private FileModel actPic;
	
	@Resource(name = "activityPicService")
	public void setActivityPicService(IActivityPicService activityPicService) {
		this.service = activityPicService;
		this.activityPicService = activityPicService;
	}
	
	@FileModelDetails(fieldName = "actPic.id",isDelOldFile = false)
	public FileModel getActPic() {
		return actPic;
	}
	
	public void setActPic(FileModel actPic) {
		this.actPic = actPic;
	}
	
	public ActivityPic getEntity() {
		return entity;
	}
	
	public void setEntity(ActivityPic entity) {
		this.entity = entity;
	}
	
	@Override
	protected ActivityPic dytEntity() {
		if(this.entity == null) {
			this.entity = new ActivityPic();
		}
		return getEntity();
	}
	@Override
	protected void dyEntity(ActivityPic t) {
		setEntity(t);
	}
	@Override
	public void setRows(List<ActivityPic> rows) {
		this.rows = rows;
	}
	@Override
	public List<ActivityPic> getRows() {
		return rows;
	}
	
	
//	@Override
//	public String ajax() {
//		String id = entity.getActivityId();
//		return super.ajax();
//	}

//	@Override
//	public String showList() {
//		
//		if (this.entity == null) {
//			this.entity = new ActivityPic();
//		}
//		String id = entity.getActivityId();
//		this.entity.setActivityId("8a99524557d23e100157d28093ce0009");
//		try {
//			this.rows = this.activityPicService.showList(this.entity, this.pager, super.getOrder());
//		} catch (BizException e) {
//			getError(e);
//		}
//		return super.showList();
//	}
		
}
